package cn.jetpiece.cloud.common.api.message;

import cn.jetpiece.cloud.common.api.message.model.params.CreateAnnouncementSendParam;
import cn.jetpiece.cloud.common.api.message.model.params.UpdateAnnouncementSendParam;
import cn.jetpiece.cloud.common.api.message.model.query.AnnouncementSendQuery;
import cn.jetpiece.cloud.common.api.message.model.result.AnnouncementSendResult;
import cn.jetpiece.cloud.model.page.PageResult;
import cn.jetpiece.cloud.model.response.Result;
import cn.jetpiece.cloud.resource.annotation.annotation.ApiResource;
import cn.jetpiece.cloud.resource.annotation.annotation.ScanResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

import javax.validation.Valid;

/**
 * 用户通告阅读标记表
 *
 * @author jetpiece
 * @since 2022-11-16
 */
@Api(tags = "用户通告阅读标记表")
@ApiResource(name = "用户通告阅读标记表")
public interface AnnouncementSendApi {

    String API = "/common/announcementSends";

    /**
     * 新增用户通告阅读标记表
     *
     * @param param 新增参数
     * @return 返回结果
     */
    @ApiOperation(value = "新增用户通告阅读标记表")
    @ScanResource(name = "新增用户通告阅读标记表", path = API, method = RequestMethod.POST)
    Result<String> add(@RequestBody @Valid CreateAnnouncementSendParam param);

    /**
     * 修改用户通告阅读标记表
     *
     * @param param 修改参数
     * @return 返回结果
     */
    @ApiOperation(value = "修改用户通告阅读标记表")
    @ScanResource(name = "修改用户通告阅读标记表", path = API, method = RequestMethod.PUT)
    Result<String> update(@RequestBody @Valid UpdateAnnouncementSendParam param);

    /**
     * 删除用户通告阅读标记表
     *
     * @param id 主键
     * @return 返回结果
     */
    @ApiOperation(value = "删除用户通告阅读标记表")
    @ScanResource(name = "删除用户通告阅读标记表", path = API + "/{id}", method = RequestMethod.DELETE)
    Result<String> delete(@PathVariable(name = "id") Long id);

    /**
     * 批量删除用户通告阅读标记表
     *
     * @param ids
     * @return 返回结果
     */
    @ApiOperation(value = "批量删除用户通告阅读标记表")
    @ScanResource(name = "批量删除用户通告阅读标记表", path = API + "/batch-del/{ids}", method = RequestMethod.DELETE)
    Result<String> deleteBatch(@PathVariable("ids") String ids);

    /**
     * 查询用户通告阅读标记表信息
     *
     * @param id 主键
     * @return 返回结果
     */
    @ApiOperation(value = "查询用户通告阅读标记表信息")
    @ScanResource(name = "查询用户通告阅读标记表信息", path = API + "/{id}", method = RequestMethod.GET)
    Result<AnnouncementSendResult> get(@PathVariable(name = "id") Long id);

    /**
     * 分页获取用户通告阅读标记表
     *
     * @param query 查询条件
     * @return 返回结果
     */
    @ApiOperation(value = "分页获取用户通告阅读标记表")
    @ScanResource(name = "分页获取用户通告阅读标记表", path = API, method = RequestMethod.GET)
    Result<PageResult<AnnouncementSendResult>> page(@Valid @SpringQueryMap AnnouncementSendQuery query);


    /**
     * 通过Excel导入用户通告阅读标记表数据
     *
     * @return 返回结果
     */
    @ApiOperation(value = "通过Excel导入用户通告阅读标记表数据")
    @ScanResource(name = "通过Excel导入用户通告阅读标记表数据", path = API + "/import-excel", method = RequestMethod.POST)
    Result<String> importExcel(MultipartHttpServletRequest request);

    /**
     * 导出用户通告阅读标记表数据到Excel
     *
     * @param query 查询条件
     * @return 返回结果
     */
    @ApiOperation(value = "通过excel导入用户通告阅读标记表数据")
    @ScanResource(name = "通过excel导入用户通告阅读标记表数据", path = API + "/export-excel", method = RequestMethod.GET)
    ModelAndView exportExcel(@Valid @SpringQueryMap AnnouncementSendQuery query);

    /**
     * 单条已读
     *
     * @return 返回结果
     */
    @ApiOperation(value = "单条已读")
    @ScanResource(name = "单条已读", path = API + "/read-one", method = RequestMethod.PUT)
    Result<String> readOne(@RequestParam(name = "announcementId", required = false) Long announcementId, @RequestParam(name = "announcementSendId", required = false) Long announcementSendId);

    /**
     * 一键已读
     *
     * @return 返回结果
     */
    @ApiOperation(value = "一键已读")
    @ScanResource(name = "一键已读", path = API + "/read-all", method = RequestMethod.PUT)
    Result<String> readAll();
}
